home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / prgtools / programm.ing / wx_lib10.zoo / wx_fscro.c < prev    next >
Encoding:
C/C++ Source or Header  |  1992-08-01  |  2.5 KB  |  83 lines

  1. #include <wx_lib.h>
  2.  
  3. /*
  4.  * This is one of the workhorse functions, and also one of the ones that'll
  5.  * have to get worked over enourmously in order to make this thing GemFast 1.8-
  6.  * independent.
  7.  *
  8.  * What it does is scroll the interior of the window up a certain number of
  9.  * text "lines".
  10.  *
  11.  * Arguments:    This function takes the Window structure that indicates which
  12.  *                window we're working on.  It also takes the VDI handle of the
  13.  *                workstation that the wx_xxxx functions are supposed to use.  It
  14.  *                also takes the number of lines that it is to scroll.
  15.  */
  16. void    wx_fscroll(ws)
  17. Window    *ws;
  18. {
  19.     /*
  20.      * This is the array for the function to clear the area of the screen that
  21.      * is "dirty" (i.e., has lines of text on it that have been scrolled up),
  22.      * and needs to be "cleaned" by painting over it with a filled rectangle.
  23.      */
  24.     int        blank[4],
  25.     /*
  26.      * This is the array that describes the two rectangles that we wish to blit
  27.      * between.
  28.      */
  29.             blit[8];
  30.     /*
  31.      * We need these MFDB's for the blit function.
  32.      */
  33.     MFDB    src,
  34.             dst;
  35.  
  36.     /*
  37.      * Set the array to point to that are of the screen that we want to
  38.      * preserve--the full width, and the first writable line of text (which
  39.      * may be different from 0, depending on the setting of the miny variable
  40.      * in the Window structure) to the height of the window minus the number
  41.      * of lines we're scrolling.
  42.      *
  43.      * 0-3 are the source, 4-7 are the destination.
  44.      */
  45.     blit[0] = ws->work.g_x;
  46.     blit[1] = ws->work.g_y + (ws->scrl * ws->hchr) + (ws->miny * ws->hchr); 
  47.     blit[2] = ws->work.g_x + ws->work.g_w - 1;
  48.     blit[3] = ws->work.g_y + ws->work.g_h - 1;
  49.     blit[4] = blit[0];
  50.     blit[5] = blit[1] - (ws->scrl * ws->hchr);
  51.     blit[6] = blit[2];
  52.     blit[7] = blit[3] - (ws->scrl * ws->hchr);
  53.     /*
  54.      * If the address of the MFDB is NULL, it points to the screen.
  55.      */
  56.     src.fd_addr = dst.fd_addr = NULL;
  57.     /*
  58.      * Set the array to the dimensions of the "dirty" screen area.
  59.      */
  60.     blank[0] = ws->work.g_x;
  61.     blank[1] = ws->work.g_y + ((ws->maxy - ws->scrl) * ws->hchr);
  62.     blank[2] = ws->work.g_x + ws->work.g_w - 1;
  63.     blank[3] = blank[1] + (ws->scrl * ws->hchr);
  64.     /*
  65.      * Turn off the mouse.
  66.      */
  67.     graf_mouse(M_OFF,NULL);
  68.     /*
  69.      * Do our VDI ops.
  70.      */
  71.     vro_cpyfm(ws->vdih,3,blit,&src,&dst);
  72.     vr_recfl(ws->vdih,blank);
  73.     /*
  74.      * Turn the mouse back on.
  75.      */
  76.     graf_mouse(M_ON,NULL);
  77.     /*
  78.      * Set the y character position to be correct by decrementing the number of
  79.      * lines we "scrolled" from it.
  80.      */
  81.     ws->ypos -= ws->scrl;
  82. }
  83.